//
//  IMSearchManager.m
//  MyPhoneApp
//
//  Created by baken on 2016/11/24.
//  Copyright © 2016年 myApp. All rights reserved.
//

#import "IMSearchManager.h"
#import "PCMainListModel.h"

@implementation IMSearchManager

+ (void)getSearchResultsWithKeys:(NSString *)keys andPageNum:(NSString *)num completionHandle:(void(^)(PCMainListModel *model,NSError *error))complete{
    NSString *url = [NSString stringWithFormat:@"%@%@?key=%@&class=0&p=%@",Api_URL,kSearch,keys,num];
    NSString *encodeUrl = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    [self POST:encodeUrl
    parameters:nil//@{@"":,@"":,@"p":}
completionHandler:^(id responseObj, NSError *error){
    PCMainListModel *model = [PCMainListModel mj_objectWithKeyValues:responseObj];
    if (model.error_code != 0) {
        error = [self createError:model.error_msg];
    }
    complete(model,error);
}];
}

@end
